home *** CD-ROM | disk | FTP | other *** search
/ ETO Development Tools 4 / ETO Development Tools 4.iso / Essentials / MacApp Documentation / MacApp.TECH$ Archives / 1990 / Dec 90 / MacApp.Tech$ 12⁄14⁄90 / 2493-Re global Reference,-Dec90 < prev    next >
Encoding:
Text File  |  1991-03-06  |  1.6 KB  |  43 lines  |  [TEXT/GEOL]

  1. Item    0925155                         12-Dec-90        23:30PST
  2.  
  3. From:   MADA.SYSOP                      MacApp Dev Assoc, Don Sawtelle,IVC
  4.  
  5. To:     MACAPP.TECH$                    MacApp Technical
  6.  
  7. ------------------------------------------------------------------------------
  8.  
  9. Sub:    Re: global Reference, ViewEdi
  10.  
  11. [From PaulLX on America Online at 90-12-12 21:26:09 EST]
  12.  
  13. Thanks!  I'll give that a try.
  14.  
  15. I just ran into another problem that I need some clarification on.  I am
  16. writing a program that does material and energy balances on combustors.  One
  17. class I created is called TGasStream, which is essentially a gas stream.  I
  18. tried to create a global Function that would add two streams together and
  19. return a third stream, with the interface:
  20.  
  21. FUNCTION AddStreams(stream1,stream2:TGasStream):TGasStream;
  22.   VAR
  23.     aGasStream : TGasStream;
  24.   Begin
  25.     { call methods from aGasStream without creating it first }
  26.   End;
  27.  
  28. I then reference methods of aGasStream inside of the Function, but never call
  29. New(aGasStream).  I get errors related to FAILNONOBJECT.  I assume that it is
  30. because aGasStream is not allocated.  If I create a New(aGasStream) within this
  31. function, do I need to Free it before I exit the function?  It seems to me that
  32. if I do the following...
  33.  
  34. New(anotherGasStream);
  35. FailNil(anotherGasStream);
  36. anotherGasStream.IGasStream;
  37. anotherGasStream :=  AddStreams(stream1,stream2);
  38.  
  39. It appears that I would have a memory leak generated if I don't Free the local
  40. variable within the Function.  Is that true?  I'm not sure, because I can't
  41. find an example that actually does something like this.
  42.  
  43.